{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 说明\n",
    "\n",
    "本文内容紧接着前面几篇文章，关于hbmqtt库的客户端和broker的API使用过程中，都涉及到的接口。\n",
    "\n",
    "# API说明\n",
    "\n",
    "## ApplicationMessage消息实例\n",
    "\n",
    "```py\n",
    "class hbmqtt.session.ApplicationMessage(packet_id, topic, qos, data, retain)\n",
    "```\n",
    "ApplicationMessage以及其子类用于存储已发布的消息信息流，这些对象根据其创建的方式（发送和接收）包含了不同的信息和QoS服务质量。\n",
    "\n",
    "### 方法：build_publish_packet\n",
    "\n",
    "根据ApplicationMessage的实例属性构建一个 `hbmqtt.mqtt.publish.PublishPacket` 包\n",
    "\n",
    "```py\n",
    "msg.build_publish_packet(dup=False)\n",
    "```\n",
    "\n",
    "参数：\n",
    "\n",
    "- dup：强制导出标识。\n",
    "\n",
    "返回：\n",
    "\n",
    "`hbmqtt.mqtt.publish.PublishPacket`\n",
    "\n",
    "### 属性：data\n",
    "\n",
    "发布消息的载荷。\n",
    "\n",
    "### 属性：packet_id\n",
    "\n",
    "发布消息的[包标识符 id](http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718025)\n",
    "\n",
    "### 属性：puback_packet\n",
    "\n",
    "`hbmqtt.mqtt.puback.PubackPacket` 实例对应的[PUBACK](http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718043) 确认包。  \n",
    "如果QoS != 1，或者 PUBCOMP 包还没发送或者没收到 的情况下 为`None`\n",
    "\n",
    "### 属性：pubcomp_packet\n",
    "\n",
    "`hbmqtt.mqtt.puback.PubrelPacket` 实例对应的 [PUBCOMP](http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718058) 包  \n",
    "如果 PUBLISH 包还没发送或者没收到的情况下为`None`\n",
    "\n",
    "### 属性：pubrec_packet\n",
    "\n",
    "`hbmqtt.mqtt.puback.PubrecPacket` 实例对应的 [PUBREC](http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718048)包  \n",
    "如果QoS != 2，或者 PUBREC 包还没发送或者没收到的情况下为`None`\n",
    "\n",
    "### 属性：pubrel_packet\n",
    "\n",
    "`hbmqtt.mqtt.puback.PubrelPacket`实例对应的 [PUBREL](http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718053)  \n",
    "如果 QoS != 2，或者 PUBREL 包还没发送或者还没收到的情况下为 `None`\n",
    "\n",
    "### 属性：qos\n",
    "\n",
    "消息服务质量\n",
    "\n",
    "### 属性：retain\n",
    "\n",
    "消息的retain值\n",
    "\n",
    "### 属性：topic\n",
    "\n",
    "消息 topic\n",
    "\n",
    "## 其他子类\n",
    "\n",
    "### IncomingApplicationMessage\n",
    "```py\n",
    "class hbmqtt.session.IncomingApplicationMessage(packet_id, topic, qos, data, retain)\n",
    "```\n",
    "\n",
    "父类：`hbmqtt.session.ApplicationMessage`\n",
    "\n",
    "进来的 `ApplicationMessage.`消息\n",
    "\n",
    "### OutgoingApplicationMessage\n",
    "\n",
    "```py\n",
    "class hbmqtt.session.OutgoingApplicationMessage(packet_id, topic, qos, data, retain)\n",
    "```\n",
    "\n",
    "父类：`hbmqtt.session.ApplicationMessage`\n",
    "\n",
    "发出的 `ApplicationMessage.`消息\n",
    "\n",
    "\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": true
  },
  "varInspector": {
   "cols": {
    "lenName": 16,
    "lenType": 16,
    "lenVar": 40
   },
   "kernels_config": {
    "python": {
     "delete_cmd_postfix": "",
     "delete_cmd_prefix": "del ",
     "library": "var_list.py",
     "varRefreshCmd": "print(var_dic_list())"
    },
    "r": {
     "delete_cmd_postfix": ") ",
     "delete_cmd_prefix": "rm(",
     "library": "var_list.r",
     "varRefreshCmd": "cat(var_dic_list()) "
    }
   },
   "types_to_exclude": [
    "module",
    "function",
    "builtin_function_or_method",
    "instance",
    "_Feature"
   ],
   "window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
